<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="com.fandy.struts.DAL.*"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.SQLException"%>
<%@page import="java.io.PrintWriter"%>

<%@page import="com.fandy.struts.Meta.GoodsInfo"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>

<%!public com.fandy.struts.Model.GoodsInfo SetGI(
			com.fandy.struts.Model.GoodsInfo gInfo, ResultSet rs)
			throws SQLException {
		gInfo.setBrand(rs.getString(GoodsInfo.getBrand()));
		gInfo.setGoodsid(rs.getInt(GoodsInfo.getGoodsid()));
		gInfo.setImage(rs.getString(GoodsInfo.getImage()));
		gInfo.setOrigin(rs.getString(GoodsInfo.getOrigin()));
		gInfo.setProfit(rs.getFloat(GoodsInfo.getProfit()));
		gInfo.setSize(rs.getString(GoodsInfo.getSize()));
		gInfo.setType(rs.getString(GoodsInfo.getType()));
		gInfo.setUnit(rs.getString(GoodsInfo.getUnit()));

		return gInfo;
	}%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html lang="true">
<head>
	<html:base />

	<title>ShowGoods.jsp</title>

	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

</head>

<body>
	&nbsp;
	<jsp:include page="MasterPages/Header.jsp" />
	<div align="right">
		<a href="ManageGoods.jsp">返回商品管理</a>
	</div>
	<hr />
	<div id="tittle" align="center">
		商品信息
	</div>

	<div id="Search" align="center">
		<table cellpadding=0 cellspacing=0 style="margin-left: 15px">
			<tr valign=top>
				<td style="height: 62px; padding-left: 92px" nowrap>
					<form name=f action="Search.do" method="post">
						<input type=text name="keyword" size=42 maxlength=100>
						<input type=submit value=找找看 id=sb>
						<span id=hp> <br> </span>
					</form>
				</td>
			</tr>
		</table>

	</div>
	<div id="Goods" align="center">

		<table>
			<%
				DALGoodsInfo gi = new DALGoodsInfo();
					ResultSet rs = null;

					com.fandy.struts.Model.GoodsInfo gInfo = new com.fandy.struts.Model.GoodsInfo();

					int i = -1;

					try {
						i = Integer.valueOf(request.getParameter("id"));
					} catch (Exception e) {
						e.printStackTrace();
					}
					
					rs = gi.GetGoodsByID(i);
					 
					if(rs.next()) {
						gInfo = SetGI(gInfo, rs);
						
			%>
			<tr>
				<td align="center" width="180">
				<html:form  action="FileUpload.do" enctype="multipart/form-data" method ="post" >				
					<a href="ShowGoods.jsp?id=<%=gInfo.getGoodsid()%>" target="_Blank"><img
							height="188" width="155" alt="<%=gInfo.getBrand()%>"
							src="../<%=gInfo.getImage()%>"> 
					</a><br>
					 <br>
					<input type="hidden" name="<%=GoodsInfo.getGoodsid() %>" value="<%=gInfo.getGoodsid() %>" />
					<html:file property="myfile" /><br>
					<br>
					<input type="submit" name="Ok" value="上传">	
					<html:errors property="org.apache.struts.action.GLOBAL_MESSAGE" />	
				</html:form>
				</td>
				<td align="left" width="200">
					<table height="125">
						<tr valign="top">
							<td rowspan="1">
								<a href="ShowGoods.jsp?id=<%=gInfo.getGoodsid()%>"
									target="_Blank"><%=gInfo.getBrand() + " " + gInfo.getType()%>
								</a>
							</td>
						</tr>

						<tr>
							<td rowspan="1">
								品牌:
								<input type="text" name="<%=GoodsInfo.getBrand()%>"
									value="<%=gInfo.getBrand()%>">
							</td>

						</tr>
						<tr>
							<td rowspan="1">
								规格:
								<input type="text" name="<%=GoodsInfo.getBrand()%>"
									value=" <%=gInfo.getSize()%>" />
							</td>

						</tr>
						<tr>
							<td rowspan="1">
								产地:
								<input type="text" name="<%=GoodsInfo.getOrigin()%>"
									value="<%=gInfo.getOrigin()%>">
							</td>
						</tr>
						<tr>
							<td rowspan="1">
								单位:
								<input type="text" name="<%=GoodsInfo.getUnit()%>"
									value=" <%=gInfo.getUnit()%>" />
							</td>

						</tr>


						<tr>
							<td rowspan="1">
								利润:
								<input type="text" name="<%=GoodsInfo.getProfit()%>"
									value=" <%=gInfo.getProfit()%>" />
							</td>

						</tr>

						<tr>

							<td rowspan="1">
								<input type="submit" name="Edit" value="修改" />
							</td>

							 

						</tr>

					</table>

				</td>

				<td align="center">

				</td>


			</tr>
			<tr>
				<td colspan="8">
					<hr />
				</td>

			</tr>
			<%
				}
			%>
		</table>

	</div>
	<jsp:include page="MasterPages/Footer.jsp" />
</body>
</html:html>







